/*
 * DateTimeThread.java
 *
 * Created on March 15, 2007, 9:43 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package busticketvendingsystem;

import javax.swing.JLabel;
import java.text.SimpleDateFormat;

/**
 *
 * @author Samik Saha
 */
public class DateTimeThread extends Thread{
    SimpleDateFormat dateTimeFormat;
    JLabel dateTime;
    /** Creates a new instance of DateTimeThread */
    public DateTimeThread(JLabel dT) {
        dateTime=dT;
        dateTimeFormat=new SimpleDateFormat("EEEEEEEEE  dd MMMMMMMMM, yyyy  hh:mm:ss aa");
    }
    public void run(){
        while(true){
            try{
                dateTime.setText(dateTimeFormat.format(new java.util.Date()));
                Thread.sleep(1000);
            }catch(InterruptedException exception){
                exception.printStackTrace();
            }
        }
    }
}
